package de.baumann.browser.activitys.order

import android.content.Context
import android.content.Intent
import android.support.v4.app.Fragment
import android.view.View
import de.baumann.browser.R
import de.baumann.browser.base.BaseOdinActivity
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.fragments.HashOrderFragment
import de.baumann.browser.fragments.LicenceOrderFragment
import de.baumann.browser.fragments.RechargeOrderFragment
import de.baumann.browser.iview.IBaseView
import kotlinx.android.synthetic.main.activity_order.*
import kotlinx.android.synthetic.main.include_tool_bar.*

/**
 *@author:
 *@date:2019/7/1 18:07
 *@discription: 订单页面
 */
@Deprecated("功能已删除")
class OrderActivity : BaseOdinActivity<IBaseView, BasePresenter<IBaseView>>(), View.OnClickListener {

    override fun getTitleText(): String {
        return getString(R.string.order)
    }

    companion object {
        fun startOrderActivity(context: Context) {
            context.startActivity(Intent(context, OrderActivity::class.java))
        }
    }

    override fun getLayout(): Int {
        return R.layout.activity_order
    }

    override fun initView() {
        initToolbar(commToolBar,commTitle)
        supportFragmentManager.beginTransaction().add(R.id.flOrder, LicenceOrderFragment.instance).commit()
        rgOrder.setOnCheckedChangeListener { _, checkedId ->
            run {
                when (checkedId) {
                    R.id.rbLicenceOrder -> {
                        changeFragment(LicenceOrderFragment())
                    }

                    R.id.rbHashOrder -> {
                        changeFragment(HashOrderFragment())
                    }

                    R.id.rbRechargeOrder -> {
                        changeFragment(RechargeOrderFragment())
                    }
                }
            }
        }
    }

    private fun changeFragment(fragment: Fragment) {
        supportFragmentManager.beginTransaction().replace(R.id.flOrder, fragment).commit()
    }

    override fun createPresenter(): BasePresenter<IBaseView>? {
        return null
    }

    override fun createView(): IBaseView? {
        return null
    }

    override fun initData() {

    }

    override fun onClick(p0: View?) {
    }
}
